package edu.ccut.saturn.basecomponent.database.impl.oracle.builder;

import java.util.HashMap;
import java.util.Map;

import edu.ccut.saturn.basecomponent.database.IDeleteSQLBuilder;
import edu.ccut.saturn.basecomponent.database.IInsertSQLBuilder;
import edu.ccut.saturn.basecomponent.database.ISelectSQLBuilder;
import edu.ccut.saturn.basecomponent.database.ISaturnSQL;
import edu.ccut.saturn.basecomponent.database.ISaturnSQLBuilder;
import edu.ccut.saturn.basecomponent.database.IUpdateSQLBuilder;

public class SaturnOracleSQLBuilder implements ISaturnSQLBuilder {
	private static Map<String, IDeleteSQLBuilder> deleteSQLBuilder = new HashMap<String, IDeleteSQLBuilder>();
	private static Map<String, IUpdateSQLBuilder> updateSQLBuilder = new HashMap<String, IUpdateSQLBuilder>();
	private static Map<String, ISelectSQLBuilder> selectSQLBuilder = new HashMap<String, ISelectSQLBuilder>();
	private static Map<String, IInsertSQLBuilder> insertSQLBuilder = new HashMap<String, IInsertSQLBuilder>();

	public SaturnOracleSQLBuilder() {
		insertSQLBuilder.put(ISaturnSQL.INSERT_OPERATION, new OracleInsertLOBSQLBuilder());
		insertSQLBuilder.put(ISaturnSQL.INSERT_LOB_OPERATION, new OracleInsertLOBSQLBuilder());
		selectSQLBuilder.put(ISaturnSQL.SELECT_OPERATION, new OracleSelectLOBSQLBuilder());
		selectSQLBuilder.put(ISaturnSQL.SELECT_COUNT_OPERATION, new OracleSelectCountSQLBuilder());
		selectSQLBuilder.put(ISaturnSQL.SELECT_LOB_OPERATION, new OracleSelectLOBSQLBuilder());
		updateSQLBuilder.put(ISaturnSQL.UPDATE_OPERATION, new OracleUpdateLOBSQLBuilder());
		updateSQLBuilder.put(ISaturnSQL.UPDATE_LOB_OPERATION, new OracleUpdateLOBSQLBuilder());
		deleteSQLBuilder.put(ISaturnSQL.DELETE_OPERATION, new OracleDeleteSQLBuilder());
	}

	public IDeleteSQLBuilder getDeleteSQLBuilder(String key) {
		return deleteSQLBuilder.get(key);
	}

	public IInsertSQLBuilder getInsertSQLBuilder(String key) {
		return insertSQLBuilder.get(key);
	}

	public ISelectSQLBuilder getSelectSQLBuilder(String key) {
		return selectSQLBuilder.get(key);
	}

	public IUpdateSQLBuilder getUpdateSQLBuilder(String key) {
		return updateSQLBuilder.get(key);
	}
}
